﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
using System.ServiceModel.Syndication;
using System.Xml;
using System.Threading;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadLeftLinks();
            DateTimeLabel.Text = DateTime.Now.ToString();
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            FullDateTimeLabel.Text = DateTime.Now.ToLongDateString();
        }
    }

    private void LoadLeftLinks()
    {
        List<string> trendsWords = CountryHelper.GetCountries();
        TrendsListView.DataSource = trendsWords;
        TrendsListView.DataBind();
    }


    protected void TrendsListView_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            ListViewDataItem data = e.Item as ListViewDataItem;
            string keyword = data.DataItem as string;
            HyperLink TrendLink = e.Item.FindControl("TrendLink") as HyperLink;
            TrendLink.Text = keyword;
            TrendLink.NavigateUrl = string.Format("~/Page.aspx?Country={0}", keyword);
        }
    }
}
